package com.he.DesignPatterns.Singleton;

/**
 * @description: 饿汉式：方式1 静态成员变量
 * @Author: HCL
 * @Date: 2024/8/23 15:18
 */
public class Singleton {

    //1 私有构造对象
    private Singleton(){}

    //2 声明Singleton对象并赋值
    private static Singleton instance = new Singleton();

    //3 提供访问方法来获取实例
    public static Singleton getInstance(){
        return instance;
    }
}
